/*
 * @Author: qiangqiang.cao
 * Copyright (c) 2023 - 2024, Shanghai Rural Commercial Bank Co., LTD. ALL rights reserved.
 */
import React from "react";

import { Navigate } from "react-router-dom";

interface AuthRouteProps {
    children: React.ReactElement;
}

export const AuthRoute: React.FC<AuthRouteProps> = ({ children }) => {
    //如果用户没有登录，重定向到登录页面
    if (!localStorage.getItem('token')) {
        return <Navigate to="/login" />;
    }
    return children;
};